#include <stdio.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdlib.h>
int main()
{
    pid_t id = fork();
    if (id == 0)
    {
        int cnt = 5;
        while (cnt--)
        {
            sleep(1);
        }
        exit(0);
    }
    int status = 0;
    while (1)
    {
        int ret = waitpid(id, &status, WNOHANG);
        printf("%d\n",ret);
        sleep(1);
    }
    return 0;
}
